package com.vercon.commonmirror.view;


import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Created by csh on 2021-03-05.
 * 数字、英文适用
 */

@SuppressLint("AppCompatCustomView")
public class EnglishTextView extends TextView {

    public EnglishTextView(Context context) {
        super(context);
        initTypeFace();
    }

    public EnglishTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initTypeFace();
    }

    public EnglishTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initTypeFace();
    }

    private void initTypeFace() {
        if (isInEditMode()) {
            if (getText().toString().trim().equals(""))
                setText("XXX");
        }
        setTypeface(FontProvider.getInstance(getContext()).getTypeface(FontProvider.english_type));
    }
}
